#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "xh_avcodeccontroler.h"
#include "renderwidget.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE


class playToolBar;
class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();

    void openMediaPlayer(const QString& filePath);

    void releasePlayer();
    void setupPlayer();
    static void updateVideoData(H264YUV_Frame* yuvFrame,unsigned long userData);
    void UpdateYUVFrameData(H264YUV_Frame* yuvFrame);
    void updateCurrentPts(uint64_t pts);

protected:
    void mouseMoveEvent(QMouseEvent* event);
    void dropEvent(QDropEvent* event);
    void dragEnterEvent(QDragEnterEvent* event);
    void resizeEvent(QResizeEvent *event);

    void updateSize();
private:
    Ui::MainWindow *ui;
    MediaType m_mediaType;

    xh_AVCodecControler* m_AVCodecControler = nullptr;

    renderWidget*         m_pOpenGLWidget         = nullptr;

    float m_nTotalMediaTime = 0.0f;

    playToolBar* m_playToolBar = nullptr;
};
#endif // MAINWINDOW_H
